Fix some wrong dataState values with network-only and errorPolicy: "none" queries - #13381
Fix some wrong dataState values with network-only and errorPolicy: "none" queries#13381jerelmiller wants to merge 33 commits into
dataState values with network-only and errorPolicy: "none" queries#13381Conversation
…ndary works as expected
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: 92852a653a04c990be3ebe32 ✅ AI Style Review — No Changes DetectedNo MDX files were changed in this pull request. Review Log: View detailed log
|
🦋 Changeset detectedLatest commit: afeff3f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe change updates incremental request metadata, preserves streaming data states across errors, adjusts network-only cache pruning, and adds regression coverage for deferred and streamed GraphQL responses. ChangesIncremental streaming state
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant IncrementalHandler
participant QueryInfo
participant QueryManager
participant ObservableQuery
IncrementalHandler->>QueryInfo: provide pending items and streamInfo
QueryInfo->>QueryInfo: determine streaming state and prune cache data
QueryManager->>QueryManager: cache GraphQL error with dataState
QueryManager->>ObservableQuery: throw cached-state-associated error
ObservableQuery->>ObservableQuery: restore streaming dataState
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/incremental/handlers/graphql17Alpha9.ts (1)
104-106: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low valueAvoid
Trie["strong"]as a public API.
makeStreamInfoTrie()always creates the stream trie thatstreamInfo()exposes, so this getter can be simplified instead of depending on the undocumented internalTrie["strong"]property used in two places.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/incremental/handlers/graphql17Alpha9.ts` around lines 104 - 106, Update the streamInfo getter to return the stream trie created by makeStreamInfoTrie() directly, removing the _streamInfo["strong"] check and dependency on the internal Trie["strong"] property while preserving the existing undefined behavior when no stream info exists.src/core/QueryInfo.ts (1)
255-256: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winDocument why only
NetworkStatus.refetchbypasses network-only pruning.
NetworkStatus.pollandNetworkStatus.setVariablesalso come from fresh network calls, but pending@defer/@streamboundaries are still pruned because they are notrefetch. Add a short comment next to theisNetworkOnlycheck that records the intended exclusion set.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/core/QueryInfo.ts` around lines 255 - 256, Add a concise comment beside the isNetworkOnly check in QueryInfo explaining that only NetworkStatus.refetch bypasses network-only pruning, while poll and setVariables still prune pending `@defer/`@stream boundaries despite using fresh network calls. Keep the existing condition unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.api-reports/api-report-incremental.api.md:
- Around line 13-15: Keep incremental implementation details internal by
updating Incremental.IncrementalRequest so its streamInfo?: StreamInfoTrie is no
longer exposed publicly, either by marking IncrementalRequest internal or
removing the internal trie field. Apply the corresponding API-report changes at
.api-reports/api-report-incremental.api.md ranges 13-15 (anchor), 239-245, and
309-335, plus .api-reports/api-report.api.md ranges 1601-1627 and 1638-1643;
ensure PendingStreamResultWithInfo remains internal-deprecated and no public
report exposes StreamInfoTrie.
In `@src/core/__tests__/client.watchQuery/streamGraphQL17Alpha9.test.ts`:
- Around line 4677-4680: Remove the broad any cast from the
enqueueSubsequentChunk call and provide the stream items with the concrete
Record<string, unknown>/ObjMap<unknown> shape expected by
FormattedIncrementalStreamResult, or cast only the runtime payload to unknown if
necessary. Keep validation of the surrounding
FormattedSubsequentIncrementalExecutionResult intact.
In `@src/incremental/types.ts`:
- Line 65: Update the comment immediately before PendingItemWithInfo to use the
TSDoc form for the `@internal` tag, matching the adjacent internal type
declarations so API extraction recognizes it correctly.
---
Nitpick comments:
In `@src/core/QueryInfo.ts`:
- Around line 255-256: Add a concise comment beside the isNetworkOnly check in
QueryInfo explaining that only NetworkStatus.refetch bypasses network-only
pruning, while poll and setVariables still prune pending `@defer/`@stream
boundaries despite using fresh network calls. Keep the existing condition
unchanged.
In `@src/incremental/handlers/graphql17Alpha9.ts`:
- Around line 104-106: Update the streamInfo getter to return the stream trie
created by makeStreamInfoTrie() directly, removing the _streamInfo["strong"]
check and dependency on the internal Trie["strong"] property while preserving
the existing undefined behavior when no stream info exists.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 2dcb7c78-86a7-453e-bd00-e3c2ae9225d1
📒 Files selected for processing (17)
.api-reports/api-report-core.api.md.api-reports/api-report-incremental.api.md.api-reports/api-report.api.md.changeset/chilly-actors-complain.md.changeset/loud-bulldogs-pay.md.changeset/swift-starfishes-know.mdsrc/cache/inmemory/__tests__/cache.diff/incremental.test.tssrc/core/ObservableQuery.tssrc/core/QueryInfo.tssrc/core/QueryManager.tssrc/core/__tests__/client.watchQuery/deferGraphQL17Alpha9.test.tssrc/core/__tests__/client.watchQuery/streamGraphQL17Alpha9.test.tssrc/core/dataStateErrorCache.tssrc/incremental/handlers/__tests__/graphql17Alpha9/defer.test.tssrc/incremental/handlers/__tests__/graphql17Alpha9/stream.test.tssrc/incremental/handlers/graphql17Alpha9.tssrc/incremental/types.ts
Summary by CodeRabbit
Bug Fixes
@deferand@stream.network-onlyqueries after deferred errors.API Updates